<template>
  <a-layout class="pageAll">
    <a-page-header
      title="上报链接"
      style="border: 1px solid rgb(235, 237, 240)"
      sub-title="所有需要上报的链接"
    >
      <!--  搜索栏    -->
      <div class="flex-row-start-center">
          <a-input-search v-model:value="search" :placeholder="'请输入链接名称/描述/链接'" :loading="inSearch" :enter-button="'搜索'" @search="onSeach"></a-input-search>
      </div>

      <a-table class="mt25" :columns="columns" :data-source="urlList" bordered :pagination="pagination" :loading="loading"
               @change="handleTableChange">

      </a-table>

    </a-page-header>
  </a-layout>
</template>

<script>
import {urlPageList} from "@/utils/api";

export default {
  name: "link-path",
  data() {
    return {
      search:'',//搜索
      pagination: {
        current: 1,
        total:0,
        pageSize: 20
      },
      columns:[
        {
          title: "序号",
          align: "center",
          customRender: ({ text, record, index }) => {
            return `${(index + 1) + (this.pagination.current - 1) * this.pagination.pageSize}`;
          }
        },
        {title: '链接名',dataIndex: 'urldesc',key: 'urldesc'},
        {title: '链接描述',dataIndex: 'remark',key: 'remark'},
        {title: '是否可用',dataIndex: 'useable',key: 'useable'},
        {title: '平台',dataIndex: 'platform',key: 'platform'},
        {title: '点击限制',dataIndex: 'limitCount',key: 'limitCount'},
        {title: '今日点击',dataIndex: 'clickCount',key: 'clickCount'},
        {title: '创建时间',dataIndex: 'createDate',key: 'createDate'},
        {title: '修改时间',dataIndex: 'modifyDate',key: 'modifyDate'},
        {title: '分组',dataIndex: 'groupId',key: 'groupId'},
        {title: '操作',dataIndex: 'option',key: 'option'}
      ],
      urlList:[],//链接列表
      inSearch:false,//是否在搜索
      loading:false,
    }
  },
  created() {
    this.loadList(1)
  },
  methods: {
    onSeach(e) {
      console.log("=====",e)
    },
    handleTableChange(page) {
      this.pagination.pageSize = page.pageSize
      this.pagination.current = page.current
      this.loadList(page.current)
    },
    loadList(page) {
      var param = {
        page: page,
        pageSize: this.pagination.pageSize
      }
      urlPageList(param).then(res => {
        console.log("data === ",res.data.data)
        this.urlList = res.data.data
      },fail => {

      })
    }
  }
}
</script>

<style scoped>

</style>